---
title: TableChef
sidebarTitle: TableChef
icon: table
iconType: solid
description: Extract tables from markdown text and prepare them for future usage.
---

The `TableChef` is a versatile chef that extracts and processes tables from multiple sources. It can read CSV and Excel files, convert them to markdown format, or extract tables from markdown text. The parsed tables are returned in a structured format ready for downstream processing.

## Installation

TableChef requires the `pandas` library for processing CSV and Excel files.

```bash
pip install "chonkie[table]"
```

<Info>
  For more installation options, see the [Installation
  Guide](/oss/installation).
</Info>

## Initialization

```python
from chonkie import TableChef

chef = TableChef()
```

## Methods

### process()

Process a file or markdown string to extract tables.

#### Parameters

<ParamField path="path" type="Union[str, Path]" required>
  Can be a file path (CSV/Excel) or a markdown string containing tables
</ParamField>

#### Returns

<ResponseField name="" type="List[MarkdownTable] | None">
  A list of `MarkdownTable` objects. `None` if no tables are found
</ResponseField>

### process_batch()

Process multiple files or markdown strings at once.

#### Parameters

<ParamField path="paths" type="Union[List[str], List[Path]]" required>
  List of file paths or markdown strings to process
</ParamField>

#### Returns

<ResponseField name="" type="List[MarkdownTable] | None">
  A list of `MarkdownTable` objects. `None` if no tables are found
</ResponseField>

## Usage

<CodeGroup>

```python CSV Files
from chonkie import TableChef

# Initialize the chef
chef = TableChef()

# Process a CSV file
markdown_table = chef.process("data.csv")
print(markdown_table)
```

```python Excel Files
from chonkie import TableChef

chef = TableChef()

# Process an Excel file
markdown_table = chef.process("spreadsheet.xlsx")
print(markdown_table)
```

```python Markdown Text
from chonkie import TableChef

chef = TableChef()

markdown = """
# My Table

| Name | Age | City |
|------|-----|------|
| Alice | 25 | New York |
| Bob | 30 | Paris |
"""

# Extract tables from markdown
tables = chef.process(markdown)
print(f"Found {len(tables)} table(s)")
```

</CodeGroup>

## Supported File Formats

- **CSV files** (`.csv`) - Comma-separated values
- **Excel files** (`.xls`, `.xlsx`) - Microsoft Excel spreadsheets
- **Markdown strings** - Text containing pipe-separated tables
